// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.errors;


/**
 * Example class how to implement interface ReadableIdentityAware
 */
public class AbstractReadableIdentityAware implements ReadableIdentityAware {

	private ReadableIdentityAware parent;

	public AbstractReadableIdentityAware() {
		super();
	}

	public void setParent(ReadableIdentityAware parent) {
		this.parent = parent;
	}

	@Override
	public ReadableIdentity getReadableId() {
		return new ReadableIdentity(getClass(), getObjectIdentifier(), parent == null ? null : parent.getReadableId());
	}
	
	/**
	 * @return a short id. may be null if no id available.
	 */
	protected Object getObjectIdentifier() {
		return null;
	}

}
